 import axios from "axios";
 //引入进度条
 import nProgress from "nprogress";
 //start:进度条开始 done:进度条结束
 //引入进度条的样式
 import "nprogress/nprogress.css"
 //配置axios
 const requests = axios.create({
     baseURL: "/mock",
     //请求响应超时
     timeout: 5000,
 });
 //请求拦截器
 requests.interceptors.request.use((config) => {
     nProgress.start()
     return config
 })

 //响应拦截器
 requests.interceptors.response.use((res) => {
     nProgress.done()
     return res.data
 }, (error) => {
     return Promise.reject(new Error('faile'))
 })
 export default requests